{extend name="../../public/admin"}
{block name="title"}{:lang('添加设备购置')}{/block}
{block name="css"}{/block}
{block name="body"}
<div id="container">


    <div style="height: 30px;"></div>
    <div>
        <form action="{:url('equipment')}" method="post" id="form0" enctype="multipart/form-data">
            <div class="form-group input-group select-right">
                <label class="input-group-addon">{:lang('项目名称')}</label>
                <input type="text" name="name" class="form-control" id="text" placeholder="名称匹配" datatype="s1-50" ajaxurl="{:url('is_name')}?type=1">
            </div>
            <div class="form-group text-center">
                <button class="btn btn-info" id="html">{:lang('立即提交')}</button>
            </div>
        </form>
    </div>

    <div class="alert">提示：项目名称必须存在</div>

</div>
{/block}
{block name="js"}
<!--自动完成-->
<link rel="stylesheet" href="__PUBLIC__/public/complete/jquery-autocomplete.css">
<script src="__PUBLIC__/public/complete/jquery-autocomplete.js"></script>
<!--验证表单-->
<script src="__PUBLIC__/public/validform/Validform_v5.3.2_min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/public/validform/style.css">
<script>
    //表单验证
    var form = $('#form0').Validform({
        tiptype:4,
        ajaxPost:true,

        beforeSubmit:function () {
            layer.load(2);
        },
        callback:function (da) {
            layer.closeAll();
            if(da == 1){
                window.parent.location.reload(); //子窗口 刷新父页面
                /*parent.layer.close(parent.layer.getFrameIndex(window.name));*/
                layer.msg('{:lang("成功")}',{icon:1});
            }
            else{

                layer.msg('{:lang("失败")}',{icon:2});
            }
        }

    });

    //输入提示
    $("#text").autocomplete({
        source: {$name}
    });
</script>
{/block}